<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let arr = [0, 1, 2, 3,
      4, 5, 6
    ]
    function deal_arr (arr, len = 3) {
      let res_arr = [];
      function deep (temp, start = 0) {
        if (temp.length >= len) {
          console.log([...temp])
          return
        }
        for (let i = start; i < arr.length; i++) {
          temp.push(arr[i]);
          start++
          deep(temp, start);
          console.log("取消副作用", start)
          temp.pop()
        }
      }
      deep([])
    }
    deal_arr(arr)
  </script>
</body>

</html>